package com.shark.commons.service;

import java.util.List;

import com.shark.commons.web.model.AjaxResponse;
import com.shark.commons.web.model.DataGrid;

/**
 * 通用Service接口
 */
public interface IService<T> {

	int insert(T entity);
	
	int insertSelective(T entity);
	
	int deleteByPrimaryKey(Object id);

    int updateByPrimaryKeySelective(T entity);

    int updateByPrimaryKey(T entity);

    T selectByPrimaryKey(Object id);
    
    List<T> selectAll() ;
    
    AjaxResponse add(T entity) ;
    
    AjaxResponse update(T entity) ;
    
    /**
     * 批量删除
     * @param ids 主键
     * @return
     */
    AjaxResponse deleteBatchByKeys(Long[] ids) ;
    
    /**
     * 分页查询
     * selectByPage是mapper.xml中的<select id="selectByPage">
     * @param entity
     * @return
     */
    List<T> selectByPage(T entity) ;
    
    /**
     * 针对EaysUI实现的分页查询
     * @param entity
     * @return
     */
    DataGrid<T> datagrid(T entity) ;

}
